package com.tianji.remark.controller;


import com.tianji.remark.domain.dto.LikeRecordFormDTO;
import com.tianji.remark.service.ILikedRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 点赞记录表 前端控制器
 * </p>
 *
 * @author ffk
 * @since 2024-06-28
 */
@Api(tags = "点赞记录接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("/likes")
public class LikedRecordController {


    private  final ILikedRecordService likedRecordService;
    /**
     * 处理点赞
     * @param likeRecordFormDTO 业务id，业务类型，点赞标志，true为点赞，false为取消点赞
     */
    @PostMapping
    public void clickLikes(@RequestBody LikeRecordFormDTO likeRecordFormDTO){
        likedRecordService.clickLikes(likeRecordFormDTO);
    }

    /**
     * 根据id批量查询点赞状态
     */
    @ApiOperation("根据业务id批量查询点过赞业务id")
    @GetMapping("/list")
    public Set<Long> queryLikedStatus(@RequestParam("bizIds") List<Long> bizIds){
        return likedRecordService.queryLikedStatus(bizIds);
    }
}
